import {createRequire} from "module";
const require = createRequire(import.meta.url);
const fs =require('fs')
import { Config } from '../components/index.js'
let ai = JSON.parse(fs.readFileSync(`./plugins/js-box-plugin/config/data/system/msg_two.json`, "utf8"));

export class AI extends plugin {
constructor () {
super({
name: 'AI',
dsc: 'AI',
event: 'message',
priority: 50001,
rule: [
{
reg: '',
fnc: 'AIMsgCheck',
log: false
}
]
})
}

async AIMsgCheck (e) {
let set = await Config.admin_set
let isplugin = set.txttwo
if (!isplugin) return false
if(!(e.msg in ai)){
return false
}
this.reply(ai[e.msg][Math.round(Math.random()*ai[e.msg].length)])
}
}